package algorithm

import "fmt"

func IntersectionInt(origin []int, new []int) []int {
	// origin, new = UniqueInt(origin), UniqueInt(new)
	originMap := make(map[int]bool, len(origin))
	for _, os := range origin {
		originMap[os] = true
	}
	res := make([]int, 0)
	for _, os := range new {
		if originMap[os] == true {
			res = append(res, os)
		}
	}
	return res
}

func RunIntersectionInt() {
	as := []int{1, 23, 2, 4, 5}
	a := []int{1, 0, 5}
	fmt.Println(IntersectionInt(as, a))
}

